<?php
/**
 * User: dimka3210
 * Date: 21.11.13
 * Time: 11:08
 */

class User {
    public function checkAdminRight() {
        if (isset($_SESSION['admin_allow'])) {
            return true;
        }

        if (!empty($_POST)) {
            if ($_POST['username'] == CNF::$params['admin']['login'] && md5(md5($_POST['pass'])) == CNF::$params['admin']['pass']) {
                $_SESSION['admin_allow'] = true;
                header('Location: /admin');
            }
        }

        return false;
    }
} 